package org.example.design.One;

import lombok.SneakyThrows;

/**
 * @Auther:Liu
 * @Testname:DemoC
 * @Date:2025/8/15 9:47
 */
//单例懒加载加锁
public class DemoC {
    private static DemoC instance;

    private DemoC() {
    }

    @SneakyThrows
    public synchronized static DemoC getInstance() {
        if (instance == null) {
            instance = new DemoC();
            Thread.sleep(2000);
        }
        return instance;
    }
}
